<p-dialog header="{{title}}" [(visible)]="display" modal="modal" width="610" [responsive]="true" (onHide)="closeTemEditMask(false)">
  <p-messages [(value)]="applymsgs"></p-messages>
  <div class="ui-grid ui-grid-responsive ui-grid-pad ui-fluid" style="margin: 10px 0px">
    <form [formGroup]="templet">

      <div class="ui-grid-row margin-bottom-1vw">
        <div class="ui-grid-col-3"></div>
        <div class="ui-grid-col-6 addr">
          <label for="">
            <span class="red_start">*</span>
            报表名称：
          </label>
          <input formControlName="name" name="name" type="text" pInputText  [style.width.%]="60" placeholder="" [(ngModel)]="name" [class.my-dirty]="isName"/>
        </div>
      </div>

      <div class="ui-grid-row margin-bottom-1vw">
        <div class="ui-grid-col-3"></div>
        <div class="ui-grid-col-6 addr">
          <label for="">
            <span class="red_start"> </span>
            报表模板：
          </label>
          <input formControlName="url_name" name="url_name" type="text" pInputText
                 [style.width.%]="60" placeholder=""
                 [(ngModel)]="url_name"[class.my-dirty]="isCode"  id='textfield'/>
          <input type="text" formControlName="url" [(ngModel)]="url" style="display: none;">
          <input type="file" class="chooseBtn" ng2FileSelect [uploader]="uploader" (change)="selectedFileOnChanged($event)"/>
          <!--<div class="file-box">
            <form method="post" enctype="multipart/form-data">
              <input type='text' formControlName="url_name" [(ngModel)]="url_name"  name='textfield' #textfield id='textfield' class='txt' />
              <input type="text" formControlName="url" [(ngModel)]="url">
              <input type="file" name="fileField" class="file" id="fileField" #fileField size="28" (change)="selectedFileOnChanged($event)" [uploader]="uploader" ng2FileSelect /><br><br>
            </form>

          </div>-->
        </div>
        <button type="button" class="upload_btn" pButton (click)="uploader.uploadAll()" label="上传" [disabled]="!templet.controls['url_name'].valid"></button>
        <button type="button" class="upload_btn" pButton (click)="clearFile()" label="清空"></button>
      </div>

      <div class="ui-grid-row margin-bottom-1vw">
        <div class="ui-grid-col-3"></div>
        <div class="ui-grid-col-6 addr">
          <label for="">
            <span class="red_start">*</span>
            周期类型：
          </label>
          <p-dropdown [options]="types" [(ngModel)]="type" formControlName="type" [style]="{'width':'167px'}" (onChange)="showWhichDate()"></p-dropdown>
        </div>
      </div>

      <div class="ui-grid-row margin-bottom-1vw">
        <div class="ui-grid-col-3"></div>
        <div class="ui-grid-col-6 addr">
          <label for="">
            <span class="red_start">*</span>
            生成方式：
          </label>
          <p-dropdown [options]="ways" [(ngModel)]="way" formControlName="way" (onChange)="showWhichDate()" [style]="{'width':'167px'}"></p-dropdown>
        </div>
      </div>

      <div class="ui-grid-row margin-bottom-1vw" *ngIf="dateShow">
        <div class="ui-grid-col-3"></div>
        <div class="ui-grid-col-6">
          <label for="">
            自动生成时间：
          </label>
          <p-calendar [showIcon]="true" dateFormat="yy-mm-dd" *ngIf="dayShow" [style.width.%]="50" ngClass="birthday" [(ngModel)]="dayTime" formControlName="dayTime" dataType="string" [timeOnly]="true" [locale]="ch"></p-calendar>

          <p-calendar [showIcon]="true" dateFormat="dd" *ngIf="monthShow" [style.width.%]="50" ngClass="birthday" [(ngModel)]="monthTime" formControlName="monthTime" dataType="string" [monthNavigator]="true" [showTime]="true" [locale]="ch"></p-calendar>

          <p-calendar [showIcon]="true" dateFormat="mm-dd" *ngIf="yearShow" [style.width.%]="50" ngClass="birthday" [(ngModel)]="yearTime" formControlName="yearTime" dataType="string" [monthNavigator]="true" [showTime]="true" [locale]="ch"></p-calendar>

          <p-dropdown [options]="weeks" [(ngModel)]="week" formControlName="week" [style]="{'width':'60px'}" *ngIf="weekShow"></p-dropdown>
          <p-calendar [showIcon]="true" dateFormat="yy-mm-dd" *ngIf="weekShow" [style.width.%]="25" [style.marginLeft.px]="16" ngClass="birthday" [(ngModel)]="weekTime" formControlName="weekTime" dataType="string" [timeOnly]="true" [locale]="ch"></p-calendar>
        </div>
      </div>

      <div class="ui-grid-row margin-bottom-1vw">
        <div class="ui-grid-col-3"></div>
        <div class="ui-grid-col-6 addr">
          <label for="">
            <span class="red_start">*</span>
            所属模块：
          </label>
          <p-dropdown [options]="sheets" [(ngModel)]="sheet" formControlName="sheet" [style]="{'width':'160px'}"></p-dropdown>
        </div>
      </div>


    </form>
  </div>
  <p-footer>
    <button type="button" pButton icon="fa-check" (click)="formSubmit()" [disabled]="!templet.controls['name'].valid || !templet.controls['url'].valid" label="保存"></button>
    <button type="button" pButton icon="fa-close" (click)="display=false" label="取消" class="ui-button-secondary"></button>
  </p-footer>
</p-dialog>
